package com.nervenets.web.enumeration;

import com.nervenets.web.controller.handler.Handler;
import com.nervenets.web.controller.handler.TestHandler;
import com.nervenets.web.controller.handler.admin.*;
import com.nervenets.web.controller.handler.admin.base.FeedbackHandleHandler;
import com.nervenets.web.controller.handler.admin.base.FeedbackListHandler;
import com.nervenets.web.controller.handler.admin.movie.*;
import com.nervenets.web.controller.handler.admin.news.NewsDeleteHandler;
import com.nervenets.web.controller.handler.admin.news.NewsEditHandler;
import com.nervenets.web.controller.handler.admin.news.NewsForManagerHandler;
import com.nervenets.web.controller.handler.admin.order.OrderExpressHandler;
import com.nervenets.web.controller.handler.admin.order.OrderListForManagerHandler;
import com.nervenets.web.controller.handler.admin.order.OrderTailConfirmHandler;
import com.nervenets.web.controller.handler.admin.order.TeamOrderListForManagerHandler;
import com.nervenets.web.controller.handler.admin.setting.*;
import com.nervenets.web.controller.handler.admin.user.*;
import com.nervenets.web.controller.handler.admin.wealth.UserWealthChangeHandler;
import com.nervenets.web.controller.handler.admin.wealth.UserWithdrawCheckHandler;
import com.nervenets.web.controller.handler.common.TagsAllHandler;
import com.nervenets.web.controller.handler.config.WxConfigHandler;
import com.nervenets.web.controller.handler.user.HomeHandler;
import com.nervenets.web.controller.handler.user.UserCenterHandler;
import com.nervenets.web.controller.handler.user.help.FeedbackSubmitHandler;
import com.nervenets.web.controller.handler.user.help.HelpCenterHandler;
import com.nervenets.web.controller.handler.user.help.InvoiceInfoGetHandler;
import com.nervenets.web.controller.handler.user.movie.MovieDetailHandler;
import com.nervenets.web.controller.handler.user.movie.MoviesHandler;
import com.nervenets.web.controller.handler.user.news.NewsDetailHandler;
import com.nervenets.web.controller.handler.user.news.NewsListHandler;
import com.nervenets.web.controller.handler.user.order.OrderDetailHandler;
import com.nervenets.web.controller.handler.user.order.OrdersHandler;
import com.nervenets.web.controller.handler.user.user.*;
import com.nervenets.web.controller.handler.user.wealth.*;
import com.nervenets.web.i18n.Translator;

/**
 * Created by Joe
 * Date: 12-12-5 下午10:34
 * Email: joesupper@vip.qq.com
 */
public enum Method {
    //基础类
    wxConfig(WxConfigHandler.class, MethodType.base),
    tags(TagsAllHandler.class, MethodType.base),
    tagDel(TagDeleteHandler.class, MethodType.base),
    tagEdit(TagEditHandler.class, MethodType.base),
    tagList(TagListHandler.class, MethodType.base),
    feedback(FeedbackSubmitHandler.class, MethodType.base),
    feedbacks(FeedbackListHandler.class, MethodType.base),
    feedbackHandle(FeedbackHandleHandler.class, MethodType.base),
    //后台管理类
    systemLogs(SystemLogListHandler.class, MethodType.manager),
    globalRuleGet(GlobalRuleGetHandler.class, MethodType.manager),
    globalRuleEdit(GlobalRuleEditHandler.class, MethodType.manager),
    adminLogin(AdminLoginHandler.class, MethodType.manager),
    adminLoginInfo(AdminLoginInfoHandler.class, MethodType.manager),
    checkStatus(CheckStatusHandler.class, MethodType.manager),
    //用户类
    home(HomeHandler.class, MethodType.user),
    userCenter(UserCenterHandler.class, MethodType.user),
    userDetail(UserDetailHandler.class, MethodType.user),
    userPay(UserPayHandler.class, MethodType.user),
    userSurplus(UserSurplusHandler.class, MethodType.user),
    userLogin(UserLoginHandler.class, MethodType.user),
    userReg(UserRegisterHandler.class, MethodType.user),
    userResetPwd(UserResetPwdHandler.class, MethodType.user),
    userSetPwd(UserSetPwdHandler.class, MethodType.user),
    userWeixinBind(UserWeixinBindHandler.class, MethodType.user),
    userWeixinCheck(UserWeixinCheckHandler.class, MethodType.user),
    userInfoEdit(UserInfoEditHandler.class, MethodType.user),
    userMobileChange(UserMobileChangeHandler.class, MethodType.user),
    mobileCheckRegistered(MobileCheckRegisteredHandler.class, MethodType.user),
    mobileValidationCode(MobileValidationCodeHandler.class, MethodType.user),
    userWealthFlows(UserWealthFlowsHandler.class, MethodType.user),
    userRewardWithdrawFlows(UserRewardWithdrawsHandler.class, MethodType.user),
    userWithdraw(UserWithdrawHandler.class, MethodType.user),
    userAuth(UserAuthHandler.class, MethodType.user),
    userCheckInviteCode(UserCheckInviteCodeHandler.class, MethodType.user),
    userInvites(UserInvitesHandler.class, MethodType.user),
    userBanks(UserBanksHandler.class, MethodType.user),
    userBankEdit(UserBankEditHandler.class, MethodType.user),
    userBankDel(UserBankDelHandler.class, MethodType.user),
    userBankWithdraw(UserBankWithdrawHandler.class, MethodType.user),
    userReward2Money(UserReward2MoneyHandler.class, MethodType.user),
    userRewardInvoice(UserRewardInvoiceHandler.class, MethodType.user),
    userAddresses(UserAddressesHandler.class, MethodType.user),
    userAddressDetail(UserAddressDetailHandler.class, MethodType.user),
    userAddressEdit(UserAddressEditHandler.class, MethodType.user),
    userAddressDef(UserAddressDefHandler.class, MethodType.user),
    userAddressDel(UserAddressDelHandler.class, MethodType.user),
    //用户管理类
    users(UserListForManagerHandler.class, MethodType.user_for_manager),
    userEdit(UserEditHandler.class, MethodType.user_for_manager),
    userRole(UserRoleHandler.class, MethodType.user_for_manager),
    userWealthChange(UserWealthChangeHandler.class, MethodType.user_for_manager),
    userWithdrawCheck(UserWithdrawCheckHandler.class, MethodType.user_for_manager),
    userDetailForManager(UserDetailForManagerHandler.class, MethodType.user_for_manager),
    userEnable(UserEnableHandler.class, MethodType.user_for_manager),
    userMarkSpecial(UserMarkSpecialHandler.class, MethodType.user_for_manager),
    userFlows(UserFlowsForManagerHandler.class, MethodType.user_for_manager),
    userInviteds(UserInvitedListHandler.class, MethodType.user_for_manager),
    userOperateTypeMoneyCount(UserOperateTypeMoneyCountHandler.class, MethodType.user_for_manager),
    userBankListForManager(BankListForManagerHandler.class, MethodType.user_for_manager),
    userRewardInvoices(UserRewardInvoicesHandler.class, MethodType.user_for_manager),
    userRewardInvoiceCheck(UserRewardInvoiceCheckHandler.class, MethodType.user_for_manager),
    userBankCheck(BankCheckHandler.class, MethodType.user_for_manager),
    userIdCheck(UserIdCheckHandler.class, MethodType.user_for_manager),
    //影片管理类,
    moviesForManager(MovieListForManagerHandler.class, MethodType.movie_for_manager),
    movieEditForManager(MovieEditHandler.class, MethodType.movie_for_manager),
    movieCheckForManager(MovieCheckHandler.class, MethodType.movie_for_manager),
    movieDetailForManager(MovieDetailForManagerHandler.class, MethodType.movie_for_manager),
    movies(MoviesHandler.class, MethodType.movie_for_manager),
    movieDetail(MovieDetailHandler.class, MethodType.movie_for_manager),
    movieStatusChange(MovieStatusChangeHandler.class, MethodType.movie_for_manager),
    movieProfit(MovieProfitHandler.class, MethodType.movie_for_manager),
    movieProfitCheck(MovieProfitCheckHandler.class, MethodType.movie_for_manager),
    //订单管理类
    orders(OrdersHandler.class, MethodType.order_for_manager),
    orderDetail(OrderDetailHandler.class, MethodType.order_for_manager),
    ordersForManager(OrderListForManagerHandler.class, MethodType.order_for_manager),
    teamOrdersForManager(TeamOrderListForManagerHandler.class, MethodType.order_for_manager),
    orderExpress(OrderExpressHandler.class, MethodType.order_for_manager),
    orderTailConfirm(OrderTailConfirmHandler.class, MethodType.order_for_manager),
    //帮助类
    helps(HelpListHandler.class, MethodType.help),
    helpEdit(HelpEditHandler.class, MethodType.help),
    helpDel(HelpDeleteHandler.class, MethodType.help),
    helpDetail(HelpDetailHandler.class, MethodType.help),
    userHelpCenter(HelpCenterHandler.class, MethodType.help),
    invoiceInfoGet(InvoiceInfoGetHandler.class, MethodType.help),
    //资讯类
    news(NewsListHandler.class, MethodType.news),
    newsDetail(NewsDetailHandler.class, MethodType.news),
    //资讯管理类
    newsForManager(NewsForManagerHandler.class, MethodType.news_for_manager),
    newsEdit(NewsEditHandler.class, MethodType.news_for_manager),
    newsDel(NewsDeleteHandler.class, MethodType.news_for_manager),

    test(TestHandler.class, MethodType.base),;

    private Class<? extends Handler> handler;
    private MethodType type;
    private boolean deprecated = false;


    Method(Class<? extends Handler> handlerClass, MethodType type) {
        this.handler = handlerClass;
        this.type = type;
    }

    Method(Class<? extends Handler> handlerClass, MethodType type, boolean deprecated) {
        this.handler = handlerClass;
        this.type = type;
        this.deprecated = deprecated;
    }

    public String getName() {
        return this.name();
    }

    public String getLabel() {
        return Translator.translate(this);
    }


    public Handler getHandler() throws IllegalAccessException, InstantiationException {
        if (null == this.handler) return null;
        return this.handler.newInstance();
    }

    public MethodType getType() {
        return type;
    }

    public boolean isDeprecated() {
        return deprecated;
    }
}
